package com.fas.system.util;

import com.fas.system.service.IFasEquipmentHistoryStatisticalService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import javax.annotation.Resource;

@Configuration
@EnableScheduling
public class ScheduledConfiguration {
    private final static Logger logger = LoggerFactory.getLogger(ScheduledConfiguration.class);

    @Resource
    private IFasEquipmentHistoryStatisticalService fasEquipmentHistoryStatisticalService;

    @Scheduled(cron="0 1 0 * * ? ") //每天凌晨 00:01:00 执行
    public void dataSynchronizationTask() {
        fasEquipmentHistoryStatisticalService.saveFasEquipmentHistoryStatistical();
        logger.info("执行设备状态统计！");
    }
}
